﻿namespace Serene.Administration {
    export namespace harpergenService {
        export const baseUrl = 'Administration/harpergen';

        export declare function ListConnections(request: Serenity.ServiceRequest, onSuccess?: (response: Serenity.ListResponse<harpergenConnection>) => void, opt?: Q.ServiceOptions<any>): JQueryXHR;
        export declare function ListTables(request: harpergenListTablesRequest, onSuccess?: (response: Serenity.ListResponse<harpergenTable>) => void, opt?: Q.ServiceOptions<any>): JQueryXHR;
        export declare function Generate(request: harpergenGenerateRequest, onSuccess?: (response: Serenity.ServiceResponse) => void, opt?: Q.ServiceOptions<any>): JQueryXHR;

        export namespace Methods {
            export declare const ListConnections: string;
            export declare const ListTables: string;
            export declare const Generate: string;
        }

        [
            'ListConnections', 
            'ListTables', 
            'Generate'
        ].forEach(x => {
            (<any>harpergenService)[x] = function (r, s, o) {
                return Q.serviceRequest(baseUrl + '/' + x, r, s, o);
            };
            (<any>Methods)[x] = baseUrl + '/' + x;
        });
    }
}
